package ${package}.view

import br.com.me.ceap.web.ui.html.DivLayout
import br.com.me.ceap.web.ui.html.HrefLinkAnchor
import br.com.me.ceap.web.view.page.AbstractTitledPageView
import org.joda.time.DateTime

/**
 * Example View extending a MECEAP handler/helper base class.
 */
class ExampleView extends AbstractTitledPageView {

    DateTime firstValue;

    ExampleView(final DateTime firstValue) {
        this.firstValue = firstValue;
    }



    @Override
    protected String getTitle() {
        return "Example view"; // @TODO: how to implement translation?
    }

    @Override
    protected void prepareDiv(final DivLayout divLayout) {
        String customRootName = stringObjectMap.get("customRootName");
        divLayout.addChildTag(new DivLayout().setTextValue("First value: " + firstValue));
        divLayout.addChildTag(new DivLayout().setTextValue("Second value: " + stringObjectMap.get("secondValue")));
        divLayout.addChildTag(new HrefLinkAnchor().setHref("/${customRootName}/do/example/components").setTextValue("Example with view and many components"));
    }
}
